<template>
    <div>
         <el-breadcrumb separator="/">
            <el-breadcrumb-item >社区购物</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/index/buybox/mygood' }">我的商品</el-breadcrumb-item>
        </el-breadcrumb>
        <el-row class="margintop20">
            <el-col>
                <el-table
                  style="width: 100%"
                    :header-cell-style="{'text-align':'center'}"
                    :cell-style="{'text-align':'center'}"
                    :data="cart">
                    <el-table-column label="#" type="index"></el-table-column>
                    <el-table-column width="50">
                        <template slot="header">
                            <el-checkbox v-model="quan"></el-checkbox>
                        </template>
                        <template slot-scope="scope">
                            <el-checkbox @change="changechecked(scope.row)" v-model="scope.row.checked"></el-checkbox>
                        </template>
                    </el-table-column>
                    <el-table-column prop="name" label="商品名称" width="200">
                        <template slot-scope="scope">
                            {{scope.row.good.name}}
                        </template>
                    </el-table-column>
                    <el-table-column label="商品图片" prop="name" width="140">
                         <template slot-scope="scope">
                            <img :src="scope.row.good.img" class="myimg" alt="">
                        </template>
                    </el-table-column>
                     <el-table-column label="单价">
                         <template slot-scope="scope">
                            {{scope.row.good.price}}
                        </template>
                    </el-table-column>
                </el-table>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import {getmycart} from "@/api"
export default {
    data(){
        return {
            cart:null,
            quan:null
        }
    },
    mounted(){
        getmycart({
            mobile:localStorage.getItem("mobile")
        })
        .then(res=>{
            if(res.type){
                this.cart = res.result
            }
        })
    }
}
</script>


<style lang="scss" scoped>
.myimg{
    width:120px;
    height:120px;
}
.carbox{
    display: flex;
    div{
        margin:0 10px; 
        font-size:14px;
        color:#303133;
    }
}
</style>